package com.maserb.monitor.entity.personal;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.maserb.monitor.entity.BaseIdEntity;
import com.maserb.monitor.entity.JwOrgEntity;
import com.maserb.monitor.entity.UserEntity;
import com.maserb.monitor.entity.schoolStudent.SchoolStudentParentEntity;

import javax.persistence.*;
import java.util.Date;

/**
 *  意见反馈
 *  @author  jimmy
 */
@Entity
@Table(name = "school_advise")
public class SchoolAdviseEntity extends BaseIdEntity {
    /**
     * 家长
     */
    private SchoolStudentParentEntity parent;

    /**
     * 教师
     */
    private UserEntity teacher;

    /**
     * 内容
     */
    private String content;

    /**
     * 类型 1：家长反馈 2：教师反馈
     */
    private String type;

    /**
     * 联系方式
     */
    private String contact;

    private Date createTime;

    private String fmtCreateTime;

    @JsonBackReference
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "parent_id")
    public SchoolStudentParentEntity getParent() {
        return parent;
    }

    public void setParent(SchoolStudentParentEntity parent) {
        this.parent = parent;
    }

    @JsonBackReference
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "teacher_id")
    public UserEntity getTeacher() {
        return teacher;
    }

    public void setTeacher(UserEntity teacher) {
        this.teacher = teacher;
    }

    @Column(name = "contact", length = 50)
    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    @Column(name = "content", length = 2000)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Column(name = "user_type", length = 2)
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Transient
    public String getFmtCreateTime() {
        return fmtCreateTime;
    }

    public void setFmtCreateTime(String fmtCreateTime) {
        this.fmtCreateTime = fmtCreateTime;
    }
}